﻿/**
*┌──────────────────────────────────────────────────────────────┐
*│　描   述：                                                    
*│　作   者：ljx                                              
*│　版   本：1.0                                                 
*│　创建时间：2021/1/18 14:17:09                             
*└──────────────────────────────────────────────────────────────┘

*┌──────────────────────────────────────────────────────────────┐
*│　命名空间: Ldt.CommonCapacitySupport.Business.Model                                   
*│　类   名：ComparePersonElementModel                                      
*└──────────────────────────────────────────────────────────────┘
*/
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Ldt.CommonCapacitySupport.Business.Model
{
    /// <summary>
    /// 人员要素比对入参模型
    /// </summary>
    public class ComparePersonElementModel : ParameterModel
    {
        /// <summary>
        /// 人员要素信息
        /// </summary>
        public List<PersonElementModel> PersonElements { get; set; }
    }
    /// <summary>
    /// 要素合并入参模型
    /// </summary>
    public class MergeElementModel : ParameterModel
    {
        /// <summary>
        /// 要素内容 utf-8 base64编码 
        /// </summary>
        public List<MergeElementBaseInfo> ElementContent { get; set; }
    }

    public class MergeXmlModel : ParameterModel
    {
        /// <summary>
        /// 合并内容
        /// </summary>
       public List<string> MergerList { get; set; }
    }

    /// <summary>
    /// 合并结果模型
    /// </summary>
    public class MergeElementResultModel
    {
        /// <summary>
        /// 系统标识
        /// </summary>
        [Required]
        public string appcode { get; set; }
        /// <summary>
        /// 案件ID
        /// </summary>
        [Required]
        public string caseid { get; set; }
        /// <summary>
        /// 案件唯一ID
        /// </summary>
        [Required]
        public string outrelateid { get; set; }
        /// <summary>
        /// 案件类型
        /// </summary>
        [Required]
        public string casetype { get; set; }
        /// <summary>
        /// 案由ID
        /// </summary>
        [Required]
        public string casecauseid { get; set; }
        /// <summary>
        /// 要素内容 utf-8 base64编码 
        /// </summary>
        public List<MergeElementResultInfo> elementcontent { get; set; }
    }

    /// <summary>
    /// 合并的要素信息
    /// </summary>
    public class MergeElementBaseInfo
    {
        /// <summary>
        /// 要素类型1=诉请要素、2=事实要素、3=证据要素分组
        /// </summary>
        public int ElementType { get; set; }
        /// <summary>
        /// 要素内容 utf-8 base64编码 
        /// </summary>
        public List<string> Contents { get; set; }
    }

    /// <summary>
    /// 合并的要素信息
    /// </summary>
    public class MergeElementResultInfo
    {
        /// <summary>
        /// 要素类型1=诉请要素、2=事实要素、3=证据要素分组
        /// </summary>
        public int elementtype { get; set; }
        /// <summary>
        /// 要素内容 utf-8 base64编码 
        /// </summary>
        public string mergeelementresult { get; set; }
    }

    /// <summary>
    /// 人员要素比对接口返回模型
    /// </summary>
    public class ComparePersonElementReturnModel : ParameterModel
    {
        public List<CompareResultModle> resultList { get; set; }
    }

    /// <summary>
    /// 人员要素比对结果  
    /// </summary>
    public class CompareResultModle
    {
        /// <summary>
        /// 认定类型  0待认定  1认定  2有异议
        /// </summary>
        public int ElementState { get; set; }
        /// <summary>
        /// 人员基础信息
        /// </summary>
        public dynamic PersonInfo { get; set; }
        /// <summary>
        /// 要素类型
        /// </summary>
        public int ElementType { get; set; }
        /// <summary>
        /// 人员要素比对结果
        /// </summary>
        public string ElementContent { get; set; }
    }

    /// <summary>
    /// 人员基础信息
    /// </summary>
    public class PersonBaseInfo
    {
        /// <summary>
        /// 人员姓名
        /// </summary>
        public string PersonName { get; set; }
        /// <summary>
        /// 人员诉讼地位
        /// </summary>
        public string SuitDegreeID { get; set; }
        /// <summary>
        /// 要素内容，当是有异议要素的时候，该字段存储当前人员的有异议的要素内容
        /// </summary>
        public string PersonElementContent { get; set; }
    }
    /// <summary>
    /// 比较人员信息
    /// </summary>
    public class PersonComparer : IEqualityComparer<PersonBaseInfo>
    {
        public static PersonComparer Default = new PersonComparer();
        #region IEqualityComparer<PersonBaseInfo> 成员
        /// <summary>
        /// 对象比较
        /// </summary>
        /// <param name="x">x</param>
        /// <param name="y">y</param>
        /// <returns></returns>
        public bool Equals(PersonBaseInfo x, PersonBaseInfo y)
        {
            if (x.PersonName == y.PersonName && x.SuitDegreeID == y.SuitDegreeID)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public int GetHashCode(PersonBaseInfo obj)
        {
            return obj.GetHashCode();
        }
        #endregion
    }
}
